package com.share.device.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.share.common.core.utils.StringUtils;
import com.share.device.domain.CabinetType;
import com.share.device.mapper.CabinetTypeMapper;
import com.share.device.service.ICabinetTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CabinetTypeServiceImpl extends ServiceImpl<CabinetTypeMapper, CabinetType> implements ICabinetTypeService {
    @Override
    public List<CabinetType> selectCabinetTypeList(CabinetType cabinetType) {
        return lambdaQuery().eq(!StringUtils.isEmpty(cabinetType.getStatus()),CabinetType::getStatus, cabinetType.getStatus())
                .like(!StringUtils.isEmpty(cabinetType.getName()), CabinetType::getName, cabinetType.getName())
                .eq(cabinetType.getTotalSlots() != null, CabinetType::getTotalSlots, cabinetType.getTotalSlots())
                .eq(!StringUtils.isEmpty(cabinetType.getDescription()), CabinetType::getDescription, cabinetType.getDescription())
                .list();
    }
}
